home *** CD-ROM | disk | FTP | other *** search
/ Robotics & Artificial Int…3 (Professional Edition) / Robotics & Artificial Intelligence Tools 2003 (Professional Edition).iso / neural network tool and application / nsinstall.exe / data1.cab / DllSys_Files / GAMAXON / Laguera.c < prev   
Encoding:
C/C++ Source or Header  |  2002-03-08  |  1.6 KB  |  52 lines

  1. // Dynamic link library implementation of NeuroSolutions LaguerreAxon component 
  2.  
  3. #include "NSDLL.h"
  4.  
  5. /***********************************/
  6. /* Forward activation of component */
  7.  
  8. __declspec(dllexport) void performGammaAxon(
  9.     DLLData *instance,    // Pointer to instance data (may be NULL)
  10.     NSFloat    *data,         // Pointer to the layers of processing elements (PEs), one for each memory tap
  11.     int     rows,        // Number of rows of PEs in the layer
  12.     int     cols,        // Number of columns of PEs in the layer
  13.     NSFloat    *delayedData,     // Pointer to a PE layer delayed by a user defined time step
  14.     int     taps,        // Number of memory taps specified by the user in the inspector
  15.     NSFloat    *gamma         // Pointer to vector of gamma coefficients, one for each PE
  16.     )
  17. {
  18.     register int i,j,k,length=rows*cols;
  19.  
  20.     for (i=0; i<length; i++) {
  21.         NSFloat gain = (NSFloat)pow(1-pow(gamma[i], 2), 0.5);
  22.         for (j=0; j<taps; j++) {
  23.             k = i + j*length;
  24.             if (j==0) {
  25.                 data[k] *= gain;
  26.                 data[k] += gamma[i]*delayedData[k];
  27.             }
  28.             else
  29.                 data[k] = gamma[i]*delayedData[k] + delayedData[k-length] - gamma[i]*data[k-length];
  30.         }  
  31.     }
  32. }
  33.  
  34. /******************************************/
  35. /* Management of instance data (OPTIONAL) */
  36. /*
  37. __declspec(dllexport) DLLData *allocGammaAxon(
  38.     DLLData    *oldInstance,    // Pointer to the last instance if reallocating
  39.     int     rows,        // Number of rows of PEs in the layer
  40.     int     cols,        // Number of columns of PEs in the layer
  41.     int     taps        // Number of taps attached to each PE
  42.     )
  43. {
  44.     DLLData *instance = allocDLLInstance(oldInstance);
  45.     return instance;
  46. }
  47.  
  48. __declspec(dllexport) void freeGammaAxon(DLLData *instance)
  49. {
  50.     freeDLLInstance(instance);
  51. }
  52. */